
# 
# compile tool
# compile param
# link    param
# exe file
# *.o file
# compile command 
# link command
#

#gcc -Wp,-MD,./.main.o.d.tmp -m64 -pthread  -march=native -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX  -I/mnt/share_disk/pktgen/dpdk-1.6.0r2/examples/l2fwd/build/include -I/mnt/share_disk/pktgen/dpdk-1.6.0r2/x86_64-default-linuxapp-gcc/include -include /mnt/share_disk/pktgen/dpdk-1.6.0r2/x86_64-default-linuxapp-gcc/include/rte_config.h -O3 -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wpointer-arith -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings   -o main.o -c /mnt/share_disk/pktgen/dpdk-1.6.0r2/examples/l2fwd/main.c

#gcc -m64 -pthread  -march=native -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX  -I/mnt/share_disk/pktgen/dpdk-1.6.0r2/examples/l2fwd/build/include -I/mnt/share_disk/pktgen/dpdk-1.6.0r2/x86_64-default-linuxapp-gcc/include -include /mnt/share_disk/pktgen/dpdk-1.6.0r2/x86_64-default-linuxapp-gcc/include/rte_config.h -O3 -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wpointer-arith -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings  -Wl,-Map=l2fwd.map,--cref -o l2fwd main.o -Wl,-export-dynamic -L/mnt/share_disk/pktgen/dpdk-1.6.0r2/examples/l2fwd/build/lib -L/mnt/share_disk/pktgen/dpdk-1.6.0r2/x86_64-default-linuxapp-gcc/lib  -L/mnt/share_disk/pktgen/dpdk-1.6.0r2/x86_64-default-linuxapp-gcc/lib -Wl,--whole-archive -Wl,-lrte_kni -Wl,-lrte_pmd_e1000 -Wl,-lrte_pmd_ixgbe -Wl,-lrte_pmd_virtio_uio -Wl,-lrte_pmd_vmxnet3_uio -Wl,-lrte_timer -Wl,-lrte_hash -Wl,-lrte_lpm -Wl,-lrte_power -Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lm -Wl,-lrt -Wl,--start-group -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lethdev -Wl,-lrte_pmd_ring -Wl,-lrte_malloc -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal -Wl,-lrte_cmdline -Wl,-lrt -Wl,-lm -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive
#CC = mips64-octeon-linux-gnu-gcc
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif

CC = gcc
CFLAGS = -Wall -O2
DPDK_CFLAGS = -I$(RTE_SDK)/x86_64-default-linuxapp-gcc/include/ -include /mnt/share_disk/pktgen/dpdk-1.6.0r2/x86_64-default-linuxapp-gcc/include/rte_config.h
LDFLAGS = -lpthread
DPDK_LDFLAGS = -L/mnt/share_disk/pktgen/dpdk-1.6.0r2/x86_64-default-linuxapp-gcc/lib -lrte_kni -lrte_pmd_e1000 -lrte_pmd_ixgbe -lrte_pmd_virtio_uio -lrte_pmd_vmxnet3_uio -lrte_timer -lrte_hash -lrte_lpm -lrte_power -lrte_meter -lrte_sched -lrte_kvargs -lrte_mbuf -lethdev -lrte_pmd_ring -lrte_malloc -lrte_mempool -lrte_ring -lrte_eal -lrte_cmdline -lrt -ldl
TARGET = xuexe
OBJS = main.o
COMPILE  = $(CC) $(CFLAGS) $(DPDK_CFLAGS) -MD -c -o $@ $<
LINK = $(CC) $< $(DPDK_LDFLAGS) $(LDFLAGS) -o $@

ALL:$(TARGET)

$(TARGET):$(OBJS)
	$(LINK)

%.o:%.c
	$(COMPILE)

-include $(OBJS:.o=.d)

clean:
	rm -f $(OBJS) *~ *.d *.o $(TARGET)
